package com.zhongfl.crm.lixiao.mapper;

import com.zhongfl.crm.enums.boss.WorkOrderSettleStatus;
import com.zhongfl.crm.model.boss.WorkOrderSettle;
import com.zhongfl.crm.model.boss.WorkOrderSettleConfirmResult;
import com.zhongfl.crm.model.boss.WorkOrderSettleQuery;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface WorkOrderSettleMapper {
    int deleteByPrimaryKey(Integer id);

    void deleteBySettleNo(String settleNo);

    int insertSelective(WorkOrderSettle record);

    WorkOrderSettle selectByPrimaryKey(Integer id);

    WorkOrderSettle selectByWorkOrderNo(String workOrderNo);

    WorkOrderSettle selectBySettleNo(String settleNo);

    List<WorkOrderSettleConfirmResult> selectByQuery(WorkOrderSettleQuery queryInfo);

    List<WorkOrderSettleConfirmResult> selectByQueryWithoutStaffCode(WorkOrderSettleQuery query);

    int updateByPrimaryKeySelective(WorkOrderSettle record);

    List<WorkOrderSettle> selectByOrderNo(String orderNo);

    List<WorkOrderSettle> selectByFromAmibaId(Integer id);

    List<WorkOrderSettle> selectByToAmibaId(Integer id);

    List<WorkOrderSettle> findAll(@Param("status") WorkOrderSettleStatus status);

    List<WorkOrderSettle> selectGradeByOrderNo(String orderNo);

    WorkOrderSettle selectDetailByWorkOrderNo(String workOrderNo);

    /**
     * 通过商务经理编码统计待评价订单
     * @param salerCode 商务经理编码
     * @return 统计数量
     */
    Integer selectUnGradeOrderCount(String salerCode);

    /**
     * 通过交付经理编码统计他所受理的已评价订单
     * @param staffCode 交付经理编码
     * @return 统计数量
     */
    Integer selectMyEvaluatedOrderCount(String staffCode);

    /**
     * 根据订单号删除结算单
     * @param orderNo
     * @return
     */
    int deleteByOrderNo(String orderNo);
}